{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "Using TensorFlow backend.\n"
     ]
    }
   ],
   "source": [
    "from dl_util import *\n",
    "from ml_util import *\n",
    "\n",
    "from eval_class_util import *\n",
    "from run_eval import split_fit_plot_predict"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Data Loading and Cleaning"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "df = pd.read_csv('eval_datasets/toxicity.txt','\\t')\n",
    "tox = df[pd.notnull(df['nontoxic'])]\n",
    "tox_maccs_all  = loadNumpy('maccs_toxic_all')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "tox_notnull_indices = df[df['nontoxic'].notnull()].index.tolist()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "tox_smiles= tox['Canonical_QSARr'].tolist()\n",
    "tox_nontoxic = tox['nontoxic'].tolist()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "saveData(tox_smiles,'tox_smiles')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(8981, 8994)"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "len(tox_smiles), len(tox_maccs_all)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "tox_maccs = []\n",
    "for i in tox_notnull_indices: \n",
    "    tox_maccs += [tox_maccs_all[i]]\n",
    "    \n",
    "tox_maccs = np.array(tox_maccs)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(8981, 8981, 8981)"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "len(tox_maccs), len(tox_nontoxic), len(tox_notnull_indices)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Converting SMILES to sequence data "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(42, 940)"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "len_tox_smiles = []\n",
    "for SMILE in tox_smiles:\n",
    "    len_tox_smiles += [len(SMILE)]\n",
    "    \n",
    "max_len_tox = max(len_tox_smiles)\n",
    "\n",
    "tox_vocab_size = generate_onehot_encoding(tox_smiles,'vocab_size')\n",
    "tox_vocab_size, max_len_tox"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "tox_encodings = generate_onehot_encoding(tox_smiles)\n",
    "tox_sequences = sequence.pad_sequences(tox_encodings, maxlen=max_len_tox)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "tox_sequences = loadNumpy('tox_sequences')\n",
    "tox_maccs = loadNumpy('tox_maccs')\n",
    "tox_nontoxic = loadNumpy('tox_nontoxic')\n",
    "tox_vocab_size, max_len_tox = (42, 940)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([False, False, False, ..., False, False, False])"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "tox_nontoxic"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Train and Test set preparation "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [],
   "source": [
    "X1_tox = tox_sequences\n",
    "X2_tox = tox_maccs \n",
    "Y_tox = tox_nontoxic\n",
    "# X1_train_tox, X1_test_tox, y_train_tox, y_test_tox = train_test_split(X1_tox, Y_tox, random_state=1024)\n",
    "# X2_train_tox, X2_test_tox, y_train_tox, y_test_tox = train_test_split(X2_tox, Y_tox, random_state=1024)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Training"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### <font color=\"red\"> CNN only </font>"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "_________________________________________________________________\n",
      "Layer (type)                 Output Shape              Param #   \n",
      "=================================================================\n",
      "embedding_3 (Embedding)      (None, 940, 32)           1344      \n",
      "_________________________________________________________________\n",
      "conv1d_5 (Conv1D)            (None, 940, 32)           3104      \n",
      "_________________________________________________________________\n",
      "max_pooling1d_5 (MaxPooling1 (None, 470, 32)           0         \n",
      "_________________________________________________________________\n",
      "conv1d_6 (Conv1D)            (None, 470, 32)           3104      \n",
      "_________________________________________________________________\n",
      "max_pooling1d_6 (MaxPooling1 (None, 235, 32)           0         \n",
      "_________________________________________________________________\n",
      "flatten_3 (Flatten)          (None, 7520)              0         \n",
      "_________________________________________________________________\n",
      "dense_3 (Dense)              (None, 1)                 7521      \n",
      "=================================================================\n",
      "Total params: 15,073\n",
      "Trainable params: 15,073\n",
      "Non-trainable params: 0\n",
      "_________________________________________________________________\n",
      "Train on 6061 samples, validate on 674 samples\n",
      "Epoch 1/20\n",
      "6061/6061 [==============================] - 2s 402us/step - loss: 0.6609 - acc: 0.6040 - precision: 0.4087 - recall: 0.9947 - auc: 0.5422 - val_loss: 0.6474 - val_acc: 0.6602 - val_precision: 0.4242 - val_recall: 1.0000 - val_auc: 0.6148\n",
      "Epoch 2/20\n",
      "6061/6061 [==============================] - 2s 337us/step - loss: 0.6125 - acc: 0.6756 - precision: 0.4241 - recall: 1.0000 - auc: 0.6458 - val_loss: 0.6152 - val_acc: 0.6706 - val_precision: 0.4246 - val_recall: 1.0000 - val_auc: 0.6679\n",
      "Epoch 3/20\n",
      "6061/6061 [==============================] - 2s 332us/step - loss: 0.5941 - acc: 0.6926 - precision: 0.4243 - recall: 1.0000 - auc: 0.6818 - val_loss: 0.6005 - val_acc: 0.6795 - val_precision: 0.4247 - val_recall: 1.0000 - val_auc: 0.6927\n",
      "Epoch 4/20\n",
      "6061/6061 [==============================] - 2s 339us/step - loss: 0.5818 - acc: 0.6963 - precision: 0.4243 - recall: 1.0000 - auc: 0.7008 - val_loss: 0.5901 - val_acc: 0.6929 - val_precision: 0.4248 - val_recall: 1.0000 - val_auc: 0.7081\n",
      "Epoch 5/20\n",
      "6061/6061 [==============================] - 2s 334us/step - loss: 0.5620 - acc: 0.7157 - precision: 0.4249 - recall: 1.0000 - auc: 0.7163 - val_loss: 0.5804 - val_acc: 0.7047 - val_precision: 0.4248 - val_recall: 1.0000 - val_auc: 0.7221\n",
      "Epoch 6/20\n",
      "6061/6061 [==============================] - 2s 335us/step - loss: 0.5487 - acc: 0.7273 - precision: 0.4248 - recall: 1.0000 - auc: 0.7281 - val_loss: 0.5854 - val_acc: 0.6914 - val_precision: 0.4248 - val_recall: 1.0000 - val_auc: 0.7336\n",
      "Epoch 7/20\n",
      "6061/6061 [==============================] - 2s 338us/step - loss: 0.5371 - acc: 0.7304 - precision: 0.4250 - recall: 1.0000 - auc: 0.7384 - val_loss: 0.5783 - val_acc: 0.7077 - val_precision: 0.4248 - val_recall: 1.0000 - val_auc: 0.7429\n",
      "Epoch 8/20\n",
      "6061/6061 [==============================] - 2s 332us/step - loss: 0.5252 - acc: 0.7360 - precision: 0.4250 - recall: 1.0000 - auc: 0.7475 - val_loss: 0.5664 - val_acc: 0.7122 - val_precision: 0.4249 - val_recall: 1.0000 - val_auc: 0.7515\n",
      "Epoch 9/20\n",
      "6061/6061 [==============================] - 2s 339us/step - loss: 0.5168 - acc: 0.7428 - precision: 0.4248 - recall: 1.0000 - auc: 0.7557 - val_loss: 0.5663 - val_acc: 0.7062 - val_precision: 0.4249 - val_recall: 1.0000 - val_auc: 0.7590\n",
      "Epoch 10/20\n",
      "6061/6061 [==============================] - 2s 340us/step - loss: 0.5048 - acc: 0.7484 - precision: 0.4246 - recall: 1.0000 - auc: 0.7623 - val_loss: 0.5614 - val_acc: 0.7166 - val_precision: 0.4249 - val_recall: 1.0000 - val_auc: 0.7659\n",
      "Epoch 11/20\n",
      "6061/6061 [==============================] - 2s 336us/step - loss: 0.4998 - acc: 0.7555 - precision: 0.4250 - recall: 1.0000 - auc: 0.7690 - val_loss: 0.5716 - val_acc: 0.7226 - val_precision: 0.4249 - val_recall: 1.0000 - val_auc: 0.7719\n",
      "Epoch 12/20\n",
      "6061/6061 [==============================] - 2s 335us/step - loss: 0.4911 - acc: 0.7593 - precision: 0.4251 - recall: 1.0000 - auc: 0.7749 - val_loss: 0.5726 - val_acc: 0.7181 - val_precision: 0.4249 - val_recall: 1.0000 - val_auc: 0.7774\n",
      "2246/2246 [==============================] - 0s 134us/step\n",
      "('Test AUC:', 0.7773314716554813)\n",
      "('History saved successfully', 'history_tox_cnn_model_dropout_0_epochs_20_batch_32_lr_0.001.pkl')\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYUAAAEKCAYAAAD9xUlFAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMi4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvhp/UCwAAIABJREFUeJzt3XmcVPWZ7/HP02ttvUG3LN0gqCirQNNxiQoSMg6YRHRiDESNmkQm3mhyzXZN7r1j4kwmZsbraBJvcjVjotGAxKgxiUsSg8tMJioIoggIEYRm7W6g94Xufu4fVRwKaOgGuqju5vt+vepV55w6deo5jf6+Z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D4SEZEeUCiIiEhAoSAiIgGFgoiIBBQKIiISUCiIHMTMOsxsRdKr1+4yNrNRyb1sivQ1J8V9CiJHqdndp6S7CJF00J6CSA+Z2UYz+xcze8vMXjOzMxLTR5nZn8xspZm9YGYjE9OHmNmTZvZm4rWvm4dMM3sg8ayB35tZOG0rJXIQhYLIocIHHT76ZNJnte4+Cfgh8R5cAX4APOTuZwOPAt9PTP8+8JK7Tybep9G+u+jHAPe5+wRgD/DxFK+PSI/pjmaRg5hZg7vHupi+EfiQu7+X6IRwu7sPNrNqYJi7701M3+buxWZWBZS5e2vSMkYBf0g8lAUz+x9Atrv/U+rXTKR72lMQOTp+mOGj0Zo03IHO7UkfolAQOTqfTHr/r8Twn9n/qMmrgVcSwy8AN0HwnOmCE1WkyLHSForIocJJPc5C/BnK+y5LLTKzlcS39ucnpt1C/OlpXyP+JLV9PZ1+Cbg/0YNmB/GA2IZIH6ZzCiI9lDinUOHu1emuRSRVdPhIREQC2lMQEZGA9hRERCSgUBARkYBCQUREAgoFEREJKBRERCTw/wEJo7FXAlTm5wAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "split_fit_plot_predict(cnn_model,  tox_sequences, tox_maccs, tox_nontoxic, tox_vocab_size, max_len_tox, \"tox\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### MLP only "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "_________________________________________________________________\n",
      "Layer (type)                 Output Shape              Param #   \n",
      "=================================================================\n",
      "dense_4 (Dense)              (None, 512)               86016     \n",
      "_________________________________________________________________\n",
      "dropout_1 (Dropout)          (None, 512)               0         \n",
      "_________________________________________________________________\n",
      "dense_5 (Dense)              (None, 256)               131328    \n",
      "_________________________________________________________________\n",
      "dropout_2 (Dropout)          (None, 256)               0         \n",
      "_________________________________________________________________\n",
      "dense_6 (Dense)              (None, 64)                16448     \n",
      "_________________________________________________________________\n",
      "dense_7 (Dense)              (None, 1)                 65        \n",
      "_________________________________________________________________\n",
      "dense_8 (Dense)              (None, 1)                 2         \n",
      "=================================================================\n",
      "Total params: 233,859\n",
      "Trainable params: 233,859\n",
      "Non-trainable params: 0\n",
      "_________________________________________________________________\n",
      "Train on 6061 samples, validate on 674 samples\n",
      "Epoch 1/20\n",
      "6061/6061 [==============================] - 2s 332us/step - loss: 0.5818 - acc: 0.7009 - precision: 0.4103 - recall: 0.9947 - auc: 0.6812 - val_loss: 0.5652 - val_acc: 0.7092 - val_precision: 0.4242 - val_recall: 1.0000 - val_auc: 0.7528\n",
      "Epoch 2/20\n",
      "6061/6061 [==============================] - 2s 263us/step - loss: 0.5136 - acc: 0.7481 - precision: 0.4245 - recall: 1.0000 - auc: 0.7717 - val_loss: 0.5245 - val_acc: 0.7418 - val_precision: 0.4246 - val_recall: 1.0000 - val_auc: 0.7860\n",
      "Epoch 3/20\n",
      "6061/6061 [==============================] - 2s 265us/step - loss: 0.4781 - acc: 0.7741 - precision: 0.4259 - recall: 1.0000 - auc: 0.7966 - val_loss: 0.5231 - val_acc: 0.7315 - val_precision: 0.4247 - val_recall: 1.0000 - val_auc: 0.8067\n",
      "Epoch 4/20\n",
      "6061/6061 [==============================] - 2s 266us/step - loss: 0.4431 - acc: 0.7969 - precision: 0.4256 - recall: 1.0000 - auc: 0.8163 - val_loss: 0.5288 - val_acc: 0.7344 - val_precision: 0.4248 - val_recall: 1.0000 - val_auc: 0.8229\n",
      "Epoch 5/20\n",
      "6061/6061 [==============================] - 2s 264us/step - loss: 0.4063 - acc: 0.8141 - precision: 0.4244 - recall: 1.0000 - auc: 0.8305 - val_loss: 0.5252 - val_acc: 0.7463 - val_precision: 0.4248 - val_recall: 1.0000 - val_auc: 0.8373\n",
      "2246/2246 [==============================] - 0s 114us/step\n",
      "('Test AUC:', 0.836472649289791)\n",
      "('History saved successfully', 'history_tox_mlp_model_dropout_0_epochs_20_batch_32_lr_0.001.pkl')\n",
      "Stats saved in model/stats_tox_mlp_model_dropout_0_epochs_20_batch_32_lr_0.001\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYUAAAEKCAYAAAD9xUlFAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMi4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvhp/UCwAAIABJREFUeJzt3XuUVOWZ7/Hv03Xp6hsNdCPKTZBg5CJC20FBRQnGhcZInHEMRI2aKGs8RzPHjJPj5JyVi3NmxsxkHC/jisfMaMyYgI5GwyQaJ3HIiROvoAYVMAGCiiKXhm5o+lbd/Zw/avemaKq7q5Hd1TS/z1q1el/eqnpqQz3P3u/e9W5zd0RERACKCh2AiIgMHioKIiISUlEQEZGQioKIiIRUFEREJKSiICIiociKgpk9YGY7zOzNHtabmd1tZhvNbK2Z1UQVi4iI5CfKI4XvA4t6WX8hMCV4LAO+G2EsIiKSh8iKgrv/GtjdS5PFwA8840VguJmdEFU8IiLSt3gB33ss8F7W/NZg2bbuDc1sGZmjCcrKyk4/5ZRTBiRAEZGhYs2aNbvcfVRf7QpZFPLm7vcD9wPU1tb66tWrCxyRiMjRxczeyaddIa8+eh8YnzU/LlgmIiIFUsiisBL4QnAV0plAg7sf0nUkIiIDJ7LuIzNbDpwHVJvZVuAbQALA3e8DngIuAjYCTcC1UcUiIiL5iawouPvSPtY78N+PxHul02m2bt1KS0vLkXg5GSCpVIpx48aRSCQKHYqIBI6KE8192bp1KxUVFUycOBEzK3Q4kgd3p66ujq1btzJp0qRChyMigSExzEVLSwtVVVUqCEcRM6OqqkpHdyKDzJAoCoAKwlFI/2Yig8+QKQoiIvLRqSgcAXV1dcyaNYtZs2Zx/PHHM3bs2HC+ra0tr9e49tprefvtt/v93hdffDFnn332QcuuvPJKnnzyyXC+vb2d4cOHh/MbNmzgwgsvZMqUKdTU1LBkyRJ27NjR7/cWkaFnSJxoLrSqqipef/11AL75zW9SXl7OLbfcclAbd8fdKSrKXYcffPDBfr/v7t27Wbt2LalUinfffZcJEyb0+ZympiY+/elPc88993DRRRcB8Oyzz1JXV8dxxx3X7xhEZGjRkUKENm7cyLRp07jiiiuYPn0627ZtY9myZdTW1jJ9+nRuu+22sO3ZZ5/N66+/Hu7V33rrrZx22mnMnTu3x734xx57jM9+9rN87nOfY8WKFXnF9PDDD3PuueeGBQFg4cKFTJ069aN9WBEZEobckcK3/v0t1n2w94i+5rQxw/jGZ6Yf1nM3bNjAD37wA2prawG4/fbbGTlyJO3t7SxYsIDLLruMadOmHfSchoYGzj33XG6//Xa+8pWv8MADD3Drrbce8trLly/nb/7mb6isrOSKK67gq1/9ap/xvPnmm5x++umH9VlEZOjTkULEJk+eHBYEyCTympoaampqWL9+PevWrTvkOSUlJVx44YUAnH766WzZsuWQNh988AHvvvsuc+fOZdq0aXR2drJhwwYg91U9utJHRPIx5I4UDnePPiplZWXh9O9//3vuuusuXn75ZYYPH86VV16Z8zr9ZDIZTsdiMdrb2w9p88gjj7Br1y4mTpwIZI4uli9fzre+9S2qqqrYs2dP2Hb37t1UV1cDMH36dF566aUj9fFEZIjRkcIA2rt3LxUVFQwbNoxt27bxzDPPHPZrLV++nF/+8pds2bKFLVu28PLLL7N8+XIAzjvvPFasWEE6nQbg+9//PgsWLADgqquu4le/+hU///nPw9datWoV69ev/wifTESGiiF3pDCY1dTUMG3aNE455RROPPFEzjrrrMN6nU2bNrFt27aDuqWmTJlCKpVizZo1fPazn+XVV1/l9NNPp6ioiClTpnDfffcBUFpayk9/+lNuvvlmbrrpJhKJBLNmzeKuu+46Ip9RRI5ulhmX7uiR6yY769ev19UzRyn924kMDDNb4+61fbVT95GIiIRUFEREJKSiICIiIRUFEREJqSiIiEhIRUFEREIqCkfAggULDvkh2p133skNN9zQ6/PKy8uBzJAVl112Wc425513Ht0vwe3uzjvvpKmpKZy/6KKLqK+vzyf0vMyaNYslS5b0GteWLVuYMWNGOP/yyy8zf/58Pv7xjzN79myuu+66g2IUkcFJReEIWLp06SGjlK5YsYKlS5fm9fwxY8bw2GOPHfb7dy8KTz311EH3T/go1q9fT0dHB8899xz79+/P6znbt2/nT/7kT/j2t7/N22+/zWuvvcaiRYvYt2/fEYlJRKKjonAEXHbZZfzsZz8Lb6izZcsWPvjgA8455xwaGxtZuHAhNTU1nHrqqfzkJz855PnZe9nNzc0sWbKEqVOncumll9Lc3By2u+GGG8Jht7/xjW8AcPfdd/PBBx+wYMGCcCiLiRMnsmvXLgDuuOMOZsyYwYwZM7jzzjvD95s6dSrXX38906dP54ILLjjofbItX76cq666igsuuCBn7Lnce++9XH311cydO/egbTR69Oi8ni8ihTP0hrl4+lb48I0j+5rHnwoX3t7j6pEjRzJnzhyefvppFi9ezIoVK7j88ssxM1KpFE888QTDhg1j165dnHnmmVxyySU9jlr63e9+l9LSUtavX8/atWupqakJ1/31X/81I0eOpKOjg4ULF7J27Vq+/OUvc8cdd7Bq1apw0Lsua9as4cEHH+Sll17C3TnjjDM499xzGTFiBL///e9Zvnw53/ve97j88st5/PHHufLKKw+J55FHHuEXv/gFGzZs4J577uHzn/98n5vrzTff5Oqrr+6znYgMPjpSOEKyu5Cyu47cna997WvMnDmT888/n/fff5/t27f3+Dq//vWvw+Q8c+ZMZs6cGa579NFHqampYfbs2bz11ls5h93O9l//9V9ceumllJWVUV5ezh/90R/x3HPPATBp0iRmzZoF9Dw89+rVq6murmbChAksXLiQ1157jd27dwManltkqBp6Rwq97NFHafHixdx88828+uqrNDU1hTey+eEPf8jOnTtZs2YNiUSCiRMn5hwuuy9/+MMf+M53vsMrr7zCiBEjuOaaaw7rdboUFxeH07FYLGf30fLly9mwYUM4PPfevXt5/PHHuf766/scnnvNmjUsXrz4sOMTkcLQkcIRUl5ezoIFC/jiF7940AnmhoYGjjvu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QGl3soGDjth8DdwfK7gf8XDEBXA7wVLJ8C3Ovu04F64I8j/jwiedMvmkW6MbNGdy/PsXwL8El33xwMPvehu1eZ2S7gBHdPB8u3uXu1me0ExmUNqtY1rPUv3H1KMP8/gYS7/5/oP5lI33SkINI/3sN0f7RmTXegc3syiKgoiPTP57L+vhBMP8+BQcmuAJ4Lpp8FboDwhi6VAxWkyOHSHorIoUqyRhoF+Lm7d12WOsLM1pLZ218aLLsJeNDM/gLYyYFRUf8MuN/MvkTmiOAGoOBDjov0RucURPIUnFOodfddhY5FJCrqPhIRkZCOFEREJKQjBRERCakoiIhISEVBRERCKgoiIhJSURARkdD/B1kYCSGcthSxAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "split_fit_plot_predict(mlp_model,  tox_sequences, tox_maccs, tox_nontoxic, tox_vocab_size, max_len_tox, \"tox\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### CNN-MLP"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "_________________________________________________________________\n",
      "Layer (type)                 Output Shape              Param #   \n",
      "=================================================================\n",
      "embedding_4 (Embedding)      (None, 940, 32)           1344      \n",
      "_________________________________________________________________\n",
      "conv1d_7 (Conv1D)            (None, 940, 32)           3104      \n",
      "_________________________________________________________________\n",
      "max_pooling1d_7 (MaxPooling1 (None, 470, 32)           0         \n",
      "_________________________________________________________________\n",
      "conv1d_8 (Conv1D)            (None, 470, 32)           3104      \n",
      "_________________________________________________________________\n",
      "max_pooling1d_8 (MaxPooling1 (None, 235, 32)           0         \n",
      "_________________________________________________________________\n",
      "flatten_4 (Flatten)          (None, 7520)              0         \n",
      "_________________________________________________________________\n",
      "dense_9 (Dense)              (None, 64)                481344    \n",
      "=================================================================\n",
      "Total params: 488,896\n",
      "Trainable params: 488,896\n",
      "Non-trainable params: 0\n",
      "_________________________________________________________________\n",
      "_________________________________________________________________\n",
      "Layer (type)                 Output Shape              Param #   \n",
      "=================================================================\n",
      "dense_10 (Dense)             (None, 512)               86016     \n",
      "_________________________________________________________________\n",
      "dense_11 (Dense)             (None, 256)               131328    \n",
      "_________________________________________________________________\n",
      "dropout_3 (Dropout)          (None, 256)               0         \n",
      "_________________________________________________________________\n",
      "dense_12 (Dense)             (None, 64)                16448     \n",
      "=================================================================\n",
      "Total params: 233,792\n",
      "Trainable params: 233,792\n",
      "Non-trainable params: 0\n",
      "_________________________________________________________________\n",
      "_________________________________________________________________\n",
      "Layer (type)                 Output Shape              Param #   \n",
      "=================================================================\n",
      "merge_1 (Merge)              (None, 128)               0         \n",
      "_________________________________________________________________\n",
      "dense_13 (Dense)             (None, 64)                8256      \n",
      "_________________________________________________________________\n",
      "dropout_4 (Dropout)          (None, 64)                0         \n",
      "_________________________________________________________________\n",
      "dense_14 (Dense)             (None, 1)                 65        \n",
      "=================================================================\n",
      "Total params: 731,009\n",
      "Trainable params: 731,009\n",
      "Non-trainable params: 0\n",
      "_________________________________________________________________\n",
      "Train on 6061 samples, validate on 674 samples\n",
      "Epoch 1/20\n",
      "6061/6061 [==============================] - 3s 520us/step - loss: 0.5646 - acc: 0.7109 - precision: 0.4197 - recall: 0.9947 - auc: 0.7162 - val_loss: 0.5284 - val_acc: 0.7374 - val_precision: 0.4242 - val_recall: 1.0000 - val_auc: 0.7703\n",
      "Epoch 2/20\n",
      "6061/6061 [==============================] - 3s 413us/step - loss: 0.4997 - acc: 0.7552 - precision: 0.4243 - recall: 1.0000 - auc: 0.7899 - val_loss: 0.5378 - val_acc: 0.7315 - val_precision: 0.4246 - val_recall: 1.0000 - val_auc: 0.8004\n",
      "Epoch 3/20\n",
      "6061/6061 [==============================] - 3s 421us/step - loss: 0.4559 - acc: 0.7855 - precision: 0.4240 - recall: 1.0000 - auc: 0.8140 - val_loss: 0.5144 - val_acc: 0.7374 - val_precision: 0.4247 - val_recall: 1.0000 - val_auc: 0.8212\n",
      "Epoch 4/20\n",
      "6061/6061 [==============================] - 3s 416us/step - loss: 0.4129 - acc: 0.8111 - precision: 0.4244 - recall: 1.0000 - auc: 0.8314 - val_loss: 0.5885 - val_acc: 0.7270 - val_precision: 0.4248 - val_recall: 1.0000 - val_auc: 0.8383\n",
      "Epoch 5/20\n",
      "6061/6061 [==============================] - 3s 415us/step - loss: 0.3575 - acc: 0.8416 - precision: 0.4248 - recall: 1.0000 - auc: 0.8474 - val_loss: 0.5320 - val_acc: 0.7596 - val_precision: 0.4248 - val_recall: 1.0000 - val_auc: 0.8545\n",
      "2246/2246 [==============================] - 0s 147us/step\n",
      "('Test AUC:', 0.8526414599359194)\n",
      "('History saved successfully', 'history_tox_merged_cnn_mlp_model_dropout_0_epochs_20_batch_32_lr_0.001.pkl')\n",
      "Stats saved in model/stats_tox_merged_cnn_mlp_model_dropout_0_epochs_20_batch_32_lr_0.001\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYUAAAEKCAYAAAD9xUlFAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMi4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvhp/UCwAAIABJREFUeJzt3XuYVfV97/H3d/Z1LjAjDF5gQEhCyk0uwxS1GoVgfVAT0cYaqFgxUZ7jOSY9pmkOzTlPTEwvpk2tl/rEY1qNxgS0GlOaaGySksaeNiooolxsiCE6ilwGZgaYGeb2PX+sNYvNMJc9OGv2MHxez7Mf1tp7zd7fWcP+fX5r/db+bXN3REREAIoKXYCIiAwfCgUREYkoFEREJKJQEBGRiEJBREQiCgUREYnEFgpm9pCZ7TGz13t53MzsXjPbYWabzaw6rlpERCQ/cR4pfAtY0sfjlwFTw9sq4Bsx1iIiInmILRTc/efA/j42WQo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y++mNNOO41f/vKXrFmzhm9+85tce+21PPXUU6xYseK4eh5//HF+/OMfs337du677z7+4A/+oN/d9frrr3PDDTf0u52IDD86UhgkuaeQck8duTtf/OIXmT17NpdccgnvvPMOu3fv7vV5fv7zn0eN8+zZs5k9e3b02BNPPEF1dTXz5s1jy5YtPU67nevf//3fufrqqyktLaWsrIzf+73f4/nnnwdgypQpzJ07F+h9eu4NGzZQWVnJpEmTWLx4Ma+88gr79+8HND23yEg18o4U+ujRx2np0qXcdtttvPzyyzQ1NUVfZPOd73yHvXv3snHjRlKpFJMnT+5xuuz+/PrXv+brX/86L730EqeddhorV648oefpkslkouVEItHj6aM1a9awffv2aHruxsZGnnrqKW6++eZ+p+feuHEjS5cuPeH6RKQwRl4oFEhZWRmLFi3iU5/61DEDzA0NDZx++umkUinWr1/Pb37zmz6f56KLLuK73/0uH/3oR3n99dfZvHkzEDTIpaWllJeXs3v3bp599lkWLlwIwKhRozh48OBxp48+8pGPsHLlSlavXo278/TTT/Ptb387r9+ns7OTJ554gtdee43x48cDwRTbX/3qV7n55ptZuHAhjz32GJdccglmxiOPPBKNadx6660sWLCAK664gnPPPReA733ve1xwwQUaV5BTV0c7tB6CtiZoPRwstx7uZ7np2PXfuRWmXRFrmQqFQbR8+XKuvvrqY65Euu666/j4xz/OOeecQ01NDdOmTevzOW655RZuvPFGpk+fzvTp06Mjjjlz5jBv3jymTZvGxIkTj5l2e9WqVSxZsoTx48ezfv366P7q6mpWrlzJggULALjpppuYN29ej6eKunv++eeZMGFCFAgQBNbWrVuj75revn07c+bMwcyoqanhL//yLwE444wzWLt2LZ///OfZs2cPRUVFXHTRRSxZsqT/nShSaO7Q1hw0wm2H82i4u9+6PxaudxzJv4SiJKTL8FQpHcliOpKltCWL6WhuY3CuK+ydps6WgtLfTt6Xweh999SIk3+76KlSPF1KZ7KYjmQJ7YkS2hIltCaKOWLFtBRlaaaYJrI0keWQZzjYkeZgZ4bGjjQHOjLUt6c40JZmf1uKvW0pGluNjs7ja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wIfdfc3w8nn3nP3sWa2DzjL3dvC+3e5e6WZ7QWqciZV65rW+sfuPjVc/19Ayt3/LP7fTKR/OlIQGRjvZXkgjuQsd6CxPRlGFAoiA/PJnH//M1z+D45OSnYd8Hy4/FPgFoi+0KV8qIoUOVHqoYgcrzhnplGAH7l712Wpp5nZZoLe/vLwvs8AD5vZnwB7OTor6h8BD5rZpwmOCG4BCj7luEhfNKYgkqdwTKHG3fcVuhaRuOj0kYiIRHSkICIiER0piIhIRKEgIiIRhYKIiEQUCiIiElEoiIhI5P8D0pSA5wxrSeoAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "split_fit_plot_predict(merged_cnn_mlp_model,  tox_sequences, tox_maccs, tox_nontoxic, tox_vocab_size, max_len_tox,\"tox\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "WARNING:tensorflow:From /usr/local/lib/python2.7/dist-packages/tensorflow/python/util/deprecation.py:497: calling conv1d (from tensorflow.python.ops.nn_ops) with data_format=NHWC is deprecated and will be removed in a future version.\n",
      "Instructions for updating:\n",
      "`NHWC` for data_format is deprecated, use `NWC` instead\n",
      "_________________________________________________________________\n",
      "Layer (type)                 Output Shape              Param #   \n",
      "=================================================================\n",
      "merge_1 (Merge)              (None, 128)               0         \n",
      "_________________________________________________________________\n",
      "dense_4 (Dense)              (None, 64)                8256      \n",
      "_________________________________________________________________\n",
      "dropout_2 (Dropout)          (None, 64)                0         \n",
      "_________________________________________________________________\n",
      "dense_5 (Dense)              (None, 1)                 65        \n",
      "=================================================================\n",
      "Total params: 271,393\n",
      "Trainable params: 271,393\n",
      "Non-trainable params: 0\n",
      "_________________________________________________________________\n",
      "Train on 6061 samples, validate on 674 samples\n",
      "Epoch 1/20\n",
      "6061/6061 [==============================] - 110s 18ms/step - loss: 0.5615 - acc: 0.7129 - precision: 0.4276 - recall: 0.9947 - auc: 0.7370 - val_loss: 0.5376 - val_acc: 0.7374 - val_precision: 0.4242 - val_recall: 1.0000 - val_auc: 0.7732\n",
      "Epoch 2/20\n",
      "6061/6061 [==============================] - 109s 18ms/step - loss: 0.5011 - acc: 0.7547 - precision: 0.4245 - recall: 1.0000 - auc: 0.7924 - val_loss: 0.5116 - val_acc: 0.7567 - val_precision: 0.4246 - val_recall: 1.0000 - val_auc: 0.8014\n",
      "Epoch 3/20\n",
      "6061/6061 [==============================] - 109s 18ms/step - loss: 0.4548 - acc: 0.7830 - precision: 0.4243 - recall: 1.0000 - auc: 0.8137 - val_loss: 0.5022 - val_acc: 0.7656 - val_precision: 0.4247 - val_recall: 1.0000 - val_auc: 0.8224\n",
      "Epoch 4/20\n",
      "6061/6061 [==============================] - 109s 18ms/step - loss: 0.4137 - acc: 0.8098 - precision: 0.4244 - recall: 1.0000 - auc: 0.8325 - val_loss: 0.5039 - val_acc: 0.7596 - val_precision: 0.4248 - val_recall: 1.0000 - val_auc: 0.8396\n",
      "Epoch 5/20\n",
      "6061/6061 [==============================] - 109s 18ms/step - loss: 0.3785 - acc: 0.8291 - precision: 0.4247 - recall: 1.0000 - auc: 0.8478 - val_loss: 0.5535 - val_acc: 0.7463 - val_precision: 0.4248 - val_recall: 1.0000 - val_auc: 0.8535\n",
      "2246/2246 [==============================] - 8s 3ms/step\n",
      "('Test AUC:', 0.8517247180480142)\n"
     ]
    },
    {
     "ename": "NameError",
     "evalue": "global name 'in_jupyter' is not defined",
     "output_type": "error",
     "traceback": [
      "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[0;31mNameError\u001b[0m                                 Traceback (most recent call last)",
      "\u001b[0;32m<ipython-input-10-e205e8b90dee>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0msplit_fit_plot_predict\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mmerged_cnn_rnn_mlp_model\u001b[0m\u001b[0;34m,\u001b[0m  \u001b[0mtox_sequences\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mtox_maccs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mtox_nontoxic\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mtox_vocab_size\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmax_len_tox\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\"tox\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
      "\u001b[0;32m/home/apx748/CEP/eval_class_util.py\u001b[0m in \u001b[0;36msplit_fit_plot_predict\u001b[0;34m(model_arch, X1, X2, Y, vocab, max_len, prefix, dropout, optimizer, lr, epochs, batch_size)\u001b[0m\n\u001b[1;32m    327\u001b[0m         \u001b[0;32mprint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"Test AUC:\"\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mauc\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    328\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 329\u001b[0;31m     \u001b[0;32mif\u001b[0m \u001b[0min_jupyter\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m    330\u001b[0m         \u001b[0mplot_history\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mhistory\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmetric\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m    331\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n",
      "\u001b[0;31mNameError\u001b[0m: global name 'in_jupyter' is not defined"
     ]
    }
   ],
   "source": [
    "split_fit_plot_predict(merged_cnn_rnn_mlp_model,  tox_sequences, tox_maccs, tox_nontoxic, tox_vocab_size, max_len_tox,\"tox\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "('tox_sequences', 'saved successfully in', 'data')\n",
      "('tox_maccs', 'saved successfully in', 'data')\n",
      "('tox_nontoxic', 'saved successfully in', 'data')\n"
     ]
    }
   ],
   "source": [
    "saveNumpy(tox_sequences, 'tox_sequences')\n",
    "saveNumpy(tox_maccs, 'tox_maccs' )\n",
    "saveNumpy(tox_nontoxic, 'tox_nontoxic')"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.12"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
